using System;
using System.ComponentModel.DataAnnotations;

namespace JGSY.CMS.LowCode.Platform.Application.DTOs
{
    /// <summary>
    /// 产品数据传输对象
    /// 用于传输产品相关的数据信息，包括产品详情、价格、库存、分类等
    /// </summary>
    public class ProductDto
    {
        /// <summary>
        /// 产品ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        [Required(ErrorMessage = "产品名称不能为空")]
        [StringLength(255, ErrorMessage = "产品名称长度不能超过255个字符")]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 产品编号/SKU
        /// </summary>
        [Required(ErrorMessage = "产品编号不能为空")]
        [StringLength(100, ErrorMessage = "产品编号长度不能超过100个字符")]
        public string Sku { get; set; } = string.Empty;

        /// <summary>
        /// 产品别名/URL slug
        /// </summary>
        [StringLength(255, ErrorMessage = "产品别名长度不能超过255个字符")]
        public string? Slug { get; set; }

        /// <summary>
        /// 产品描述
        /// </summary>
        [StringLength(500, ErrorMessage = "产品描述长度不能超过500个字符")]
        public string? Description { get; set; }

        /// <summary>
        /// 产品详情
        /// </summary>
        public string? Content { get; set; }

        /// <summary>
        /// 分类ID
        /// </summary>
        public long? CategoryId { get; set; }

        /// <summary>
        /// 标签（JSON格式）
        /// </summary>
        public string? Tags { get; set; }

        /// <summary>
        /// 产品图片（JSON格式）
        /// </summary>
        public string? Images { get; set; }

        /// <summary>
        /// 产品规格（JSON格式）
        /// </summary>
        public string? Specifications { get; set; }

        /// <summary>
        /// 产品属性（JSON格式）
        /// </summary>
        public string? Attributes { get; set; }

        /// <summary>
        /// 价格
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "价格不能为负数")]
        public decimal Price { get; set; }

        /// <summary>
        /// 原价
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "原价不能为负数")]
        public decimal? OriginalPrice { get; set; }

        /// <summary>
        /// 成本价
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "成本价不能为负数")]
        public decimal? CostPrice { get; set; }

        /// <summary>
        /// 库存数量
        /// </summary>
        [Range(0, int.MaxValue, ErrorMessage = "库存数量不能为负数")]
        public int Stock { get; set; }

        /// <summary>
        /// 销售数量
        /// </summary>
        public int SalesCount { get; set; }

        /// <summary>
        /// 重量（克）
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "重量不能为负数")]
        public decimal? Weight { get; set; }

        /// <summary>
        /// 长度（厘米）
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "长度不能为负数")]
        public decimal? Length { get; set; }

        /// <summary>
        /// 宽度（厘米）
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "宽度不能为负数")]
        public decimal? Width { get; set; }

        /// <summary>
        /// 高度（厘米）
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "高度不能为负数")]
        public decimal? Height { get; set; }

        /// <summary>
        /// 是否为虚拟商品
        /// </summary>
        public bool IsVirtual { get; set; }

        /// <summary>
        /// 是否可以下载
        /// </summary>
        public bool IsDownloadable { get; set; }

        /// <summary>
        /// SEO标题
        /// </summary>
        [StringLength(255, ErrorMessage = "SEO标题长度不能超过255个字符")]
        public string? SeoTitle { get; set; }

        /// <summary>
        /// SEO关键词
        /// </summary>
        [StringLength(500, ErrorMessage = "SEO关键词长度不能超过500个字符")]
        public string? SeoKeywords { get; set; }

        /// <summary>
        /// SEO描述
        /// </summary>
        [StringLength(500, ErrorMessage = "SEO描述长度不能超过500个字符")]
        public string? SeoDescription { get; set; }

        /// <summary>
        /// 自定义属性
        /// </summary>
        public string? CustomFields { get; set; }

        /// <summary>
        /// 排序权重
        /// </summary>
        public int SortOrder { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public byte Status { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        public int Version { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        public long CreatedBy { get; set; }

        /// <summary>
        /// 修改人ID
        /// </summary>
        public long? UpdatedBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }

        /// <summary>
        /// 创建人姓名
        /// </summary>
        public string? CreatorName { get; set; }

        /// <summary>
        /// 修改人姓名
        /// </summary>
        public string? UpdaterName { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string? CategoryName { get; set; }

        /// <summary>
        /// 主图片URL
        /// </summary>
        public string? MainImageUrl { get; set; }
    }
}
